<template>
	<view>
		<view class="tab">
			<view class="list">
				<text v-for="(item,index) in tablist" :class="{ active: active === index}" @click="tabChange(index)" :key="index">{{item}}</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"tabTitle",
		props:{
			tablist:{
				type:Array,
				default:()=>{
					return []
				}
			},
			active:{
				type:Number,
				default:0
			}
		},
		methods: {
			tabChange (index) {
				this.$emit('tabChange',index);
			}
		}
	}
</script>

<style lang="scss" scoped>
.tab{
	padding: 0 50rpx;
	
	.list {
		@include between;
		
		text{
			font-size: 30rpx;
			font-family: Source Han Sans CN;
			font-weight: 400;
			color: #666666;
		}
		
		.active{
			font-size: 32rpx;
			font-family: Source Han Sans CN;
			font-weight: bold;
			color: #FF6509;
			position: relative;
			
			&::after{
				content: '';
				width: 30rpx;
				height: 8rpx;
				border-radius: 4rpx;
				background-color: #FF6509;
				position: absolute;
				bottom: -8rpx;
				left: 50%;
				transform: translateX(-50%);
			}
		}
	}
}
</style>
